package patrol.mobile.com.mobilepatrol.activity.security.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.dl7.recycler.adapter.BaseQuickAdapter;
import com.dl7.recycler.adapter.BaseViewHolder;

import patrol.mobile.com.mobilepatrol.R;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencySaveCheck1Activity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencySaveCheckReview1Activity;
import patrol.mobile.com.mobilepatrol.bean.AnquanJcBean;
import patrol.mobile.com.mobilepatrol.bean.SaveCheckLeaderBean;

/**
 * Created by K on 2018/9/11.
 * des:
 */
public class EmergencySaveCheckLeader1ListAdapter extends BaseQuickAdapter<SaveCheckLeaderBean> {
    public EmergencySaveCheckLeader1ListAdapter(Context context) {
        super(context);
    }

    @Override
    protected int attachLayoutRes() {
        return R.layout.item_emergency_save_check_leader1_list;
    }

    @Override
    protected void convert(BaseViewHolder holder, final SaveCheckLeaderBean item) {

        holder.setText(R.id.tv_num, (holder.getLayoutPosition() + 1) + "");
        holder.setText(R.id.tv_problemName, item.getProblemName());
        if (item.getProblemLevel().equals("0")) {
            holder.setText(R.id.tv_problemLevel, "无隐患");
        } else if (item.getProblemLevel().equals("1")) {
            holder.setText(R.id.tv_problemLevel, "一般隐患");
        } else {
            holder.setText(R.id.tv_problemLevel, "重大隐患");
        }
        holder.setText(R.id.tv_yesRectify, item.getYesRectify().equals("0") ? "未整改" : "已整改");
        holder.setText(R.id.tv_checkDate, item.getCheckDate());


        holder.getView(R.id.rl_root).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(mContext, EmergencySaveCheck1Activity.class);
                intent.putExtra("id", item.getOrgId());
                mContext.startActivity(intent);
            }
        });
    }
}
